package com.gzc.pm.bean
{
	import cn.skyclass.business.SessionManager;
	
	import com.gzc.pm.enum.AlarmRuleEnum;

	public class LineChartItemBean
	{
		public function LineChartItemBean(xAxisStr:String='',
									  value:Number=NaN, average:Number=NaN, stdD:Number=NaN,
									  level1:Number=NaN, level2:Number=NaN,
									  standard:Number=NaN,
									  testItemKey:String='', testItemName:String='', testDate:String='')
		{
			this.xAxisStr = xAxisStr;
			this.value = value;
			this.average = average;
			this.stdD = stdD;
			this.level1 = level1;
			this.level2 = level2;
			this.standard = standard;
			
			this.testItemKey = testItemKey;
			this.testItemName = testItemName;
			this.testDate = testDate;
		}
		
		public var xAxisStr:String;//x轴值
		public var value:Number;//y轴值
		public var average:Number;//平均值
		public var stdD:Number;//标准差
		public var level1:Number;//上控制线/公差线
		public var level2:Number;//下控制线/公差线
		public var standard:Number;//StandardEnum.value
		public var testItemKey:String;//检测项Key
		public var testItemName:String;//检测项名称
		public var testDate:String;//检测时间
		
		/*控制图告警规则*/
		public var b1:Boolean;
		public var v1:Number;
		public var b2:Boolean;
		public var v2:Number;
		public var b3:Boolean;
		public var v3:Number;
		public var b4:Boolean;
		public var v4:Number;
		public var b5:Boolean;
		public var v5:Number;
		public var b6:Boolean;
		public var v6:Number;
		public var b7:Boolean;
		public var v7:Number;
		public var b8:Boolean;
		public var v8:Number;
		
		/*公差图告警规则*/
		public var b1_t:Boolean;
		public var b2_t:Boolean;
		
		public function get alarmTip():String{
			var rule:AlarmRuleBean = SessionManager.current.getAttribute('alarmRule') as AlarmRuleBean;
			
			var tip:String = '';
			if(b1) tip += AlarmRuleEnum.RULE1.desc.replace(/\{0\}/g, rule.vRule1);
			if(b2) tip += (tip?'\n':'')+AlarmRuleEnum.RULE2.desc.replace(/\{0\}/g, rule.vRule2);
			if(b3) tip += (tip?'\n':'')+AlarmRuleEnum.RULE3.desc.replace(/\{0\}/g, rule.vRule3);
			if(b4) tip += (tip?'\n':'')+AlarmRuleEnum.RULE4.desc.replace(/\{0\}/g, rule.vRule4);
			if(b5) tip += (tip?'\n':'')+AlarmRuleEnum.RULE5.desc.replace(/\{0\}/g, rule.vRule5+1).replace(/\{1\}/g, rule.vRule5);
			if(b6) tip += (tip?'\n':'')+AlarmRuleEnum.RULE6.desc.replace(/\{0\}/g, rule.vRule6+1).replace(/\{1\}/g, rule.vRule6);
			if(b7) tip += (tip?'\n':'')+AlarmRuleEnum.RULE7.desc.replace(/\{0\}/g, rule.vRule7);
			if(b8) tip += (tip?'\n':'')+AlarmRuleEnum.RULE8.desc.replace(/\{0\}/g, rule.vRule8);
			
			return tip;
		}
	}
}